<template>
    <div>
        <input type="button" class="btn btn-primary" value="添加" @click="add">
        <h1>会员等级显示</h1>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td>Id</td>
                    <td>会员等级</td>
                </tr>
                <tr v-for="item in data.list" >
                    <td>{{item.id}}</td>
                    <td>{{item.levelName}}</td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import{ref,reactive,onMounted} from 'vue'

import axios from 'axios';
import {useRouter}from 'vue-router'
import router from '@/router';


const add=()=>{
    router.push('/leveladd');
}

onMounted(()=>{
    levelshow();
})

let data:any=reactive({
    list:[]
})

const levelshow=()=>{
    axios({
        method:'get',
        url:'/api/Member/GetUserLevels',

    })
    .then(res=>{
        console.log(res);
        data.list=res.data;

    })
    .catch(err=>{
        console.log(err);
    })
}

</script>

<style scoped>

</style>